﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.NetworkInformation;
using System.Text;
using System.Threading.Tasks;

namespace DuBaiCoffee2.Model
{
    public class RobotModelRight
    {
        private static RobotModelRight instance;
        private RobotModelRight() { }
        public static RobotModelRight Instance
        {
            get
            {
                if (instance == null)
                {
                    instance = new RobotModelRight();
                }
                return instance;
            }
        }
        #region 机器人右臂操作
        /// <summary>
        /// 制作咖啡右 开 8
        /// </summary>
        public void RobotKFJR_UP()
        {
            try
            {
                RobotSerialPort.Instance.WriteSingleCoil(1, (ushort)40, true);
            }
            catch
            {
            }
        }
        /// <summary> 
        /// 制作咖啡右 关 8
        /// </summary>
        public void RobotKFJR_Down()
        {
            try
            {
                RobotSerialPort.Instance.WriteSingleCoil(1, (ushort)40, false);
            }
            catch
            {
            }
        }
        /// <summary>
        /// 加冰右 开 9
        /// </summary>
        public void RobotJBR_UP()
        {
            try
            {
                RobotSerialPort.Instance.WriteSingleCoil(1, (ushort)41, true);
            }
            catch
            {
            }
        }

        /// <summary>
        /// 加冰右 关 9
        /// </summary>
        public void RobotJBR_Down()
        {
            try
            {
                RobotSerialPort.Instance.WriteSingleCoil(1, (ushort)41, false);
            }
            catch
            {
            }
        }
        /// <summary>
        /// 拉花右 开 10
        /// </summary>
        public void RobotLHR_UP()
        {
            try
            {
                RobotSerialPort.Instance.WriteSingleCoil(1, (ushort)42, true);
            }
            catch
            {
            }
        }

        /// <summary>
        /// 拉花右 关 10
        /// </summary>
        public void RobotLHR_Down()
        {
            try
            {
                RobotSerialPort.Instance.WriteSingleCoil(1, (ushort)42, false);
            }
            catch
            {
            }
        }
        /// <summary>
        /// 出冰完成右 开 11
        /// </summary>
        public void RobotCBWCR_UP()
        {
            try
            {
                RobotSerialPort.Instance.WriteSingleCoil(1, (ushort)43, true);
            }
            catch
            {
            }
        }

        /// <summary>
        /// 出冰完成右 关 11
        /// </summary>
        public void RobotCBWCR_Down()
        {
            try
            {
                RobotSerialPort.Instance.WriteSingleCoil(1, (ushort)43, false);
            }
            catch
            {
            }
        }
        /// <summary>
        /// 倒冰右 开 12
        /// </summary>
        public void RobotDBR_UP()
        {
            try
            {
                RobotSerialPort.Instance.WriteSingleCoil(1, (ushort)44, true);
            }
            catch
            {
            }
        }

        /// <summary>
        /// 倒冰右 关 12
        /// </summary>
        public void RobotDBR_Down()
        {
            try
            {
                RobotSerialPort.Instance.WriteSingleCoil(1, (ushort)44, false);
            }
            catch
            {
            }
        }
        /// <summary>
        /// 接奶完成右 开 13
        /// </summary>
        public void RobotJNWCR_UP()
        {
            try
            {
                RobotSerialPort.Instance.WriteSingleCoil(1, (ushort)45, true);
            }
            catch
            {
            }
        }

        /// <summary>
        /// 接奶完成右 关 13
        /// </summary>
        public void RobotJNWCR_Down()
        {
            try
            {
                RobotSerialPort.Instance.WriteSingleCoil(1, (ushort)45, false);
            }
            catch
            {
            }
        }
        /// <summary>
        /// 洗杯右 开 14
        /// </summary>
        public void RobotXBR_UP()
        {
            try
            {
                RobotSerialPort.Instance.WriteSingleCoil(1, (ushort)46, true);
            }
            catch
            {
            }
        }
        /// <summary>
        /// 洗杯右 关 14
        /// </summary>
        public void RobotXBR_Down()
        {
            try
            {
                RobotSerialPort.Instance.WriteSingleCoil(1, (ushort)46, false);
            }
            catch
            {
            }
        }
        /// <summary>
        /// 冰品接奶右 开 16
        /// </summary>
        public void RobotBPJNR_UP()
        {
            try
            {
                RobotSerialPort.Instance.WriteSingleCoil(1, (ushort)48, true);
            }
            catch
            {
            }
        }
        /// <summary>
        /// 冰品接奶右 关 16
        /// </summary>
        public void RobotBPJNR_Down()
        {
            try
            {
                RobotSerialPort.Instance.WriteSingleCoil(1, (ushort)48, false);
            }
            catch
            {
            }
        }
        /// <summary>
        /// 冰品接奶完成右 开 17
        /// </summary>
        public void RobotBPJNWCR_UP()
        {
            try
            {
                RobotSerialPort.Instance.WriteSingleCoil(1, (ushort)49, true);
            }
            catch
            {
            }
        }
        /// <summary>
        /// 冰品接奶完成右 关 17
        /// </summary>
        public void RobotBPJNWCR_Down()
        {
            try
            {
                RobotSerialPort.Instance.WriteSingleCoil(1, (ushort)49, false);
            }
            catch
            {
            }
        }
        /// <summary>
        /// 机器人停止运行右 开 20
        /// </summary>
        public void RobotJQRTZYXR_UP()
        {
            try
            {
                RobotSerialPort.Instance.WriteSingleCoil(1, (ushort)52, true);
            }
            catch
            {
            }
        }
        /// <summary>
        ///  机器人停止运行右 关 20
        /// </summary>
        public void RobotJQRTZYXR_Down()
        {
            try
            {
                RobotSerialPort.Instance.WriteSingleCoil(1, (ushort)52, false);
            }
            catch
            {
            }
        }
        /// <summary>
        /// 机器人运行右 开 21
        /// </summary>
        public void RobotJQRYXR_UP()
        {
            try
            {
                RobotSerialPort.Instance.WriteSingleCoil(1, (ushort)53, true);
            }
            catch
            {
            }
        }
        /// <summary>
        ///  机器人运行右 关 21
        /// </summary>
        public void RobotJQRYXR_Down()
        {
            try
            {
                RobotSerialPort.Instance.WriteSingleCoil(1, (ushort)53, false);
            }
            catch
            {
            }
        }
        /// <summary>
        /// 机器人报警确认右 开 22
        /// </summary>
        public void RobotJQRBJQRR_UP()
        {
            try
            {
                RobotSerialPort.Instance.WriteSingleCoil(1, (ushort)54, true);
            }
            catch
            {
            }
        }
        /// <summary>
        ///  机器人报警确认右 关 22
        /// </summary>
        public void RobotJQRBJQRR_Down()
        {
            try
            {
                RobotSerialPort.Instance.WriteSingleCoil(1, (ushort)54, false);
            }
            catch
            {
            }
        }
        /// <summary>
        /// 机器人上电右 开 23
        /// </summary>
        public void RobotJQRSDR_UP()
        {
            try
            {
                RobotSerialPort.Instance.WriteSingleCoil(1, (ushort)55, true);
            }
            catch
            {
            }
        }
        /// <summary>
        ///  机器人上电右 关 23
        /// </summary>
        public void RobotJQRSDR_Down()
        {
            try
            {
                RobotSerialPort.Instance.WriteSingleCoil(1, (ushort)55, false);
            }
            catch
            {
            }
        }
        /// <summary>
        /// 机器人下电右 开 24
        /// </summary>
        public void RobotJQRXDR_UP()
        {
            try
            {
                RobotSerialPort.Instance.WriteSingleCoil(1, (ushort)56, true);
            }
            catch
            {
            }
        }
        /// <summary>
        ///  机器人下电右 关 24
        /// </summary>
        public void RobotJQRXDR_Down()
        {
            try
            {
                RobotSerialPort.Instance.WriteSingleCoil(1, (ushort)56, false);
            }
            catch
            {
            }
        }
        /// <summary>
        /// 机器人使能右 开 25
        /// </summary>
        public void RobotJQRSNR_UP()
        {
            try
            {
                RobotSerialPort.Instance.WriteSingleCoil(1, (ushort)57, true);
            }
            catch
            {
            }
        }
        /// <summary>
        ///  机器人使能右 关 25
        /// </summary>
        public void RobotJQRSNR_Down()
        {
            try
            {
                RobotSerialPort.Instance.WriteSingleCoil(1, (ushort)57, false);
            }
            catch
            {
            }
        }
        /// <summary>
        /// 机器人下使能右 开 26
        /// </summary>
        public void RobotJQRXSNR_UP()
        {
            try
            {
                RobotSerialPort.Instance.WriteSingleCoil(1, (ushort)58, true);
            }
            catch
            {
            }
        }
        /// <summary>
        ///  机器人下使能右 关 26
        /// </summary>
        public void RobotJQRXSNR_Down()
        {
            try
            {
                RobotSerialPort.Instance.WriteSingleCoil(1, (ushort)58, false);
            }
            catch
            {
            }
        }
        /// <summary>
        /// 机器人暂停右 开 27
        /// </summary>
        public void RobotJQRZTR_UP()
        {
            try
            {
                RobotSerialPort.Instance.WriteSingleCoil(1, (ushort)59, true);
            }
            catch
            {
            }
        }
        /// <summary>
        ///  机器人暂停右 关 27
        /// </summary>
        public void RobotJQRZTR_Down()
        {
            try
            {
                RobotSerialPort.Instance.WriteSingleCoil(1, (ushort)59, false);
            }
            catch
            {
            }
        }
        /// <summary>
        /// 机器人继续运行右 开 28
        /// </summary>
        public void RobotJQRJXYXR_UP()
        {
            try
            {
                RobotSerialPort.Instance.WriteSingleCoil(1, (ushort)60, true);
            }
            catch
            {
            }
        }
        /// <summary>
        ///  机器人继续运行右 关 28
        /// </summary>
        public void RobotJQRJXYXR_Down()
        {
            try
            {
                RobotSerialPort.Instance.WriteSingleCoil(1, (ushort)60, false);
            }
            catch
            {
            }
        }
        #endregion
        #region 机器人右臂查询
        /// <summary>
        /// 到原点 8
        /// </summary>
        public bool RRobotDYD_Sel()
        {
            try
            {
                return RobotSerialPort.Instance.ReadDiscreteInputs(1, (ushort)8, (ushort)1)[0];
            }
            catch
            {
                return false;
            }
        }
        /// <summary>
        /// 到制冰机 9
        /// </summary>
        public bool RRobotDZBJ_Sel()
        {
            try
            {
                return RobotSerialPort.Instance.ReadDiscreteInputs(1, (ushort)9, (ushort)1)[0];
            }
            catch
            {
                return false;
            }
        }
        /// <summary>
        /// 倒冰完成 10
        /// </summary>
        public bool RRobotDBWC_Sel()
        {
            try
            {
                return RobotSerialPort.Instance.ReadDiscreteInputs(1, (ushort)10, (ushort)1)[0];
            }
            catch
            {
                return false;
            }
        }
        /// <summary>
        /// 到拉花点 11
        /// </summary>
        public bool RRobotDLHD_Sel()
        {
            try
            {
                return RobotSerialPort.Instance.ReadDiscreteInputs(1, (ushort)11, (ushort)1)[0];
            }
            catch
            {
                return false;
            }
        }
        /// <summary>
        /// 到倒冰点 12
        /// </summary>
        public bool RRobotDDBD_Sel()
        {
            try
            {
                return RobotSerialPort.Instance.ReadDiscreteInputs(1, (ushort)12, (ushort)1)[0];
            }
            catch
            {
                return false;
            }
        }
        /// <summary>
        /// 到咖啡机 13
        /// </summary>
        public bool RRobotDKFJ_Sel()
        {
            try
            {
                return RobotSerialPort.Instance.ReadDiscreteInputs(1, (ushort)13, (ushort)1)[0];
            }
            catch
            {
                return false;
            }
        }
        /// <summary>
        /// 到洗杯点 14
        /// </summary>
        public bool RRobotQXBD_Sel()
        {
            try
            {
                return RobotSerialPort.Instance.ReadDiscreteInputs(1, (ushort)14, (ushort)1)[0];
            }
            catch
            {
                return false;
            }
        }
        /// <summary>
        /// 冰品到接奶点 15
        /// </summary>
        public bool RRobotBPDJND_Sel()
        {
            try
            {
                return RobotSerialPort.Instance.ReadDiscreteInputs(1, (ushort)15, (ushort)1)[0];
            }
            catch
            {
                return false;
            }
        }
        /// <summary>
        /// 机器人1运行 30
        /// </summary>
        public bool RRobotJQRYX_Sel()
        {
            try
            {
                return RobotSerialPort.Instance.ReadDiscreteInputs(1, (ushort)30, (ushort)1)[0];
            }
            catch
            {
                return false;
            }
        }
        /// <summary>
        /// 机器人1报警 31
        /// </summary>
        public bool RRobotJQRBJ_Sel()
        {
            try
            {
                return RobotSerialPort.Instance.ReadDiscreteInputs(1, (ushort)31, (ushort)1)[0];
            }
            catch
            {
                return false;
            }
        }
        /// <summary>
        /// 机器人1急停 32
        /// </summary>
        public bool RRobotQJRJT_Sel()
        {
            try
            {
                return RobotSerialPort.Instance.ReadDiscreteInputs(1, (ushort)32, (ushort)1)[0];
            }
            catch
            {
                return false;
            }
        }
        /// <summary>
        /// 机器人1已开机 33
        /// </summary>
        public bool RRobotJQRYKJ_Sel()
        {
            try
            {
                return RobotSerialPort.Instance.ReadDiscreteInputs(1, (ushort)33, (ushort)1)[0];
            }
            catch
            {
                return false;
            }
        }
        /// <summary>
        /// 机器人1已上电 34
        /// </summary>
        public bool RRobotJQRYSD_Sel()
        {
            try
            {
                return RobotSerialPort.Instance.ReadDiscreteInputs(1, (ushort)34, (ushort)1)[0];
            }
            catch
            {
                return false;
            }
        }
        /// <summary>
        /// 机器人1已使能 35
        /// </summary>
        public bool RRobotJQRYSN_Sel()
        {
            try
            {
                return RobotSerialPort.Instance.ReadDiscreteInputs(1, (ushort)35, (ushort)1)[0];
            }
            catch
            {
                return false;
            }
        }
        /// <summary>
        /// 机器人1暂停 36
        /// </summary>
        public bool RRobotJQRZT_Sel()
        {
            try
            {
                return RobotSerialPort.Instance.ReadDiscreteInputs(1, (ushort)36, (ushort)1)[0];
            }
            catch
            {
                return false;
            }
        }
        /// <summary>
        /// 机器人1运动中 37
        /// </summary>
        public bool RRobotJQRYDZ_Sel()
        {
            try
            {
                return RobotSerialPort.Instance.ReadDiscreteInputs(1, (ushort)37, (ushort)1)[0];
            }
            catch
            {
                return false;
            }
        }
        #endregion
    }
}
